<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/11/1
 * Time: 16:54
 */

if (!defined('IN_DISCUZ')) {
    exit('Access Denied');
}

$data = [
    'uid' => $_G['uid'],
    'username' => $_G['username'],
    'channelId' => $_POST['channelId'],
    'content' => $_POST['content'],
    'date' => date('Y-m-d H:i:s')
];

$zid = $_POST['zid'];

//写入数据库中
$result = C::t('#zhibo#comment')->add($data);

$newData = [
    'uid' => $_G['uid'],
    'username' => $_G['username'],
    'channelId' => $_POST['channelId'],
    'content' => $_POST['content'],
    'date' => date('Y-m-d H:i:s'),
    'id' => $result //返回id值
];

echo json_encode($newData);